<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>产品管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript"
	src="/jeesite/static/jquery-tablesorter/jquery.tablesorter.js"></script>
<link href="/jeesite/static/jquery-tablesorter/themes/blue/style.css"
	rel="stylesheet" type="text/css">
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$("#contentTable").tablesorter();
						$("#btnExport")
								.click(
										function() {
											top.$.jBox
													.confirm(
															"确认要导出产品数据吗？",
															"系统提示",
															function(v, h, f) {
																if (v == "ok") {
																	$(
																			"#searchForm")
																			.attr(
																					"action",
																					"${ctx}/cg/componentRecord/export");
																	$(
																			"#searchForm")
																			.submit();
																}
															},
															{
																buttonsFocus : 1
															});
											top.$('.jbox-body .jbox-icon').css(
													'top', '55px');
										});

					});

	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").attr("action", "${ctx}/cg/componentRecord");
		$("#searchForm").submit();
		return false;
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">

		<li ><shiro:hasPermission
				name="cg:component:viewComponentList"> 
				<a href="${ctx}/cg/component/">元器件列表</a>
			 </shiro:hasPermission> </li>
		<shiro:hasPermission name="cg:component:edit"> 
			<li><a href="${ctx}/cg/component/form">产品添加</a></li>
		 </shiro:hasPermission> 
		<li class="active"><shiro:hasPermission
				name="cg:component:viewComponentRecord"> 
				<a href="${ctx}/cg/componentRecord">元器件出入库记录</a>
			 </shiro:hasPermission> </li>

	</ul>

	<form:form id="searchForm" modelAttribute="componentRecord"
		action="${ctx}/cg/componentRecord" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<ul class="ul-form">

			<li><label>产品名称：</label> <form:input path="component.name"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>
			<li><label>型号：</label> <form:input path="component.model"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>
			<li><label>封装：</label> <form:input path="component.pack"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>
			<li><label>规格：</label> <form:input path="component.spec"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>
			<li><label>库位：</label> <form:input path="component.location"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>
			
			<br></br>
			<li><label>开始日期：</label>&nbsp;<form:input id="beginDate"
					path="beginDate" readonly="true" maxlength="40"
					class="input-small Wdate" value="${paramMap.beginDate}"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" />
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
			<li><label>结束日期：</label>&nbsp;<form:input id="endDate"
					path="endDate" readonly="true" maxlength="40"
					class="input-small Wdate" value="${paramMap.endDate}"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" /></li>
					
			<li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</span> <label>操作人：</label> <form:input path="createByName"
					htmlEscape="false" maxlength="40" class="input-medium" /></li>		
					
			<li class="btns"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</span> <input id="btnSubmit" class="btn btn-primary" type="submit"
				value="查询" onclick="return page();" /> <input id="btnExport"
				class="btn btn-primary" type="button" value="导出数据" /></li>
			<li class="clearfix"></li>

		</ul>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed tablesorter">
		<thead>
			<tr>
				<th>名称</th>
				<th>型号</th>
				<th>封装</th>
				<th>规格</th>
				<th>库位</th>

				<th>操作类型</th>
				<th>操作数量</th>
				<th>操作人</th>

				<th>备注</th>
				<th>操作时间</th>

			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="componentRecord">
				<tr>
					<td>${componentRecord.component.name}</td>
					<td>${componentRecord.component.model}</td>
					<td>${componentRecord.component.pack}</td>
					<td>${componentRecord.component.spec}</td>
					<td>${componentRecord.component.location}</td>

					<c:if test="${componentRecord.recordOperateType=='1'}">
						<td>出库</td>
						<td><font color="red">&#45;${componentRecord.recordOperateNum}</font></td>
					</c:if>
					<c:if test="${componentRecord.recordOperateType=='0'}">
						<td>入库</td>
						<td><font color="green">&#43;${componentRecord.recordOperateNum}</font></td>
					</c:if>
					<td>${componentRecord.createBy.name}</td>
					<td>${componentRecord.remarks}</td>
					<td><fmt:formatDate value="${componentRecord.createDate}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
				</tr>


				<%-- <div id="myModal${component.id}" class="modal hide fade" tabindex="-1"
						role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-hidden="true">×</button>
							<h3 id="myModalLabel">${component.name}</h3>
						</div>
						<div class="modal-body">

						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
							<button class="btn btn-primary" onclick = "submitInAndOut();">保存</button>
						</div>
					</div> --%>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>